package com.sugon.modules.analyse.consts;

/**
 * 设备状态
 *
 * @author YuXD
 * @date 2020-12-23 16:58
 */
public enum DevStatus {

    TINGZHI("停机", 0),
    YUNXING("运行", 1),
    KONGXIAN("空闲", 2),
    LIXIAN("离线", 3),
    SHEDING("设定", 4),
    WEIZHI("未知", -1),
    WEIPEIZHI("未采集", -2);

    private String desc;

    private Integer value;

    DevStatus(String desc, Integer value) {
        this.desc = desc;
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public Integer getValue() {
        return value;
    }

    public static DevStatus getInstance(Integer value) {
        DevStatus[] devStatuses = values();
        for (DevStatus devStatus : devStatuses) {
            if (devStatus.getValue().equals(value)) {
                return devStatus;
            }
        }
        return DevStatus.WEIZHI;
    }

}
